VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CReporte"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private crApp As New CRAXDRT.Application
Private crReport As New CRAXDRT.Report



Public Sub mostrarReporteVentas(bParms As BParametrosReporte)
 Dim i As Integer
    If bParms.bResumen Then
        Set crReport = crApp.OpenReport(App.Path & "\reports\rptVentasDiario.rpt", 1)
    Else
        If bParms.bAgrupaCompanias Then
            Set crReport = crApp.OpenReport(App.Path & "\reports\rptVentas.rpt", 1)
        Else
            Set crReport = crApp.OpenReport(App.Path & "\reports\rptVentasxCompania.rpt", 1)
        End If
    End If
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    crReport.ParameterFields(1).AddCurrentValue (UCase(bParms.bCompania.sRazonSocial))
    crReport.ParameterFields(2).AddCurrentValue (bParms.dFechaFin)
    crReport.ParameterFields(3).AddCurrentValue (bParms.dFechaIni)
    crReport.ParameterFields(4).AddCurrentValue ("'" + bParms.bCompania.sRuc + "'")
    
    
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = "admin"
    Next i
    frmReport.viewer.EnableExportButton = True
    frmReport.viewer.EnableNavigationControls = True
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub


Public Sub mostrarReporteEmpleados()
Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptEmpleados.rpt", 1)
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = "admin"
    Next i
    frmReport.viewer.EnableExportButton = True
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub
Public Sub mostrarReporteListaServicios()
Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptProductos.rpt", 1)
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = "admin"
    Next i
    frmReport.viewer.EnableExportButton = True
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub


Public Sub mostrarReporteListaClientesAfiliados()
Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptClienteNaturales.rpt", 1)
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = "admin"
    Next i
    frmReport.viewer.EnableExportButton = True
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show

End Sub
Public Sub mostrarReporteResumenComisiones(bParms As BParametrosReporte)
 Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptComisionResumen.rpt", 1)
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    crReport.ParameterFields(1).AddCurrentValue bParms.dFechaFin
    crReport.ParameterFields(2).AddCurrentValue bParms.dFechaIni
    crReport.ParameterFields(3).AddCurrentValue (bParms.bEmpleado.nCodigo)
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = "admin"
    Next i
    frmReport.viewer.EnableExportButton = True
    frmReport.viewer.EnableNavigationControls = True
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub

Public Sub mostrarReporteComisiones(bParms As BParametrosReporte)
    Dim i As Integer
    If bParms.OcultarCampos Then
        Set crReport = crApp.OpenReport(App.Path & "\reports\rptComisionEmp.rpt", 1)
    Else
        Set crReport = crApp.OpenReport(App.Path & "\reports\rptComision.rpt", 1)
    End If
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    crReport.ParameterFields(1).AddCurrentValue (bParms.dFechaFin)
    crReport.ParameterFields(2).AddCurrentValue (bParms.dFechaIni)
    crReport.ParameterFields(3).AddCurrentValue (bParms.bEmpleado.nCodigo)
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = "admin"
    Next i
    frmReport.viewer.EnableExportButton = True
    frmReport.viewer.EnableNavigationControls = True
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub



Public Sub mostrarReporteEmpleadosTop(bParms As BParametrosReporte)
    Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptTopProduccionEmpleados.rpt", 1)
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    crReport.ParameterFields(1).AddCurrentValue "'" + Format(bParms.dFechaFin, bParametro.sFormatoFecha) + "'"
    crReport.ParameterFields(2).AddCurrentValue "'" + Format(bParms.dFechaIni, bParametro.sFormatoFecha) + "'"
    crReport.ParameterFields(3).AddCurrentValue (bParms.nNumRegistros)
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = "admin"
    Next i
    frmReport.viewer.EnableExportButton = True
    frmReport.viewer.EnableNavigationControls = True
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub


Public Sub mostrarReporteDocumentos(bParms As BParametrosReporte)
 Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptDocumentos.rpt", 1)
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    crReport.ParameterFields(1).AddCurrentValue (UCase(bParms.bCompania.sRazonSocial))
    crReport.ParameterFields(2).AddCurrentValue (bParms.dFechaFin)
    crReport.ParameterFields(3).AddCurrentValue (bParms.dFechaIni)
    crReport.ParameterFields(4).AddCurrentValue ("'" + bParms.bCompania.sRuc + "'")
    
    
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = "admin"
    Next i
    frmReport.viewer.EnableExportButton = True
    frmReport.viewer.EnableNavigationControls = True
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub

